﻿//=====================================================================================================
// LocalizationLibrary
// The Localization Library is a collection of reusable software component that provide 
// support for localization. This library enable you to localize WPF, Silverlight and WP7 applications.
// (http://localizationlibrary.codeplex.com)
//=====================================================================================================
// Author: Nicola Gallo (Website: www.nicola.gallo.name, Email: nicolagmt@hotmail.it) 
//=====================================================================================================

namespace HelloWorld.Startup
{
    //.NET References
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Windows.Data;

    //LocalizationLibrary References
    using LocalizationLibrary;

    // HelloWorld References
    using HelloWorld.Startup.Localization;
    using HelloWorld.Startup.Views;

    /// <summary>
    /// Defines the main page.
    /// </summary>
    public partial class MainPage : UserControl
    {
        //Constructors

        /// <summary>
        /// Default constructor.
        /// </summary>
        public MainPage()
        {
            InitializeComponent();
        }

        //Properties

        /// <summary>
        /// Gets the view's content control.
        /// </summary>
        public ContentControl ViewContentControl
        {
            get
            {
                return this.viewContentControl;
            }
        }

        //Methods

        /// <summary>
        /// Occurs when the main page is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //Initialize view.
            ApplicationManager.SetCurrentView<HeaderView>(this.headerContentControl);
            ApplicationManager.SetCurrentView<MenuView>();

            Binding binding = new Binding("IsLocalizing");
            binding.Source = LocalizationLibrary.LocalizationManager.EngineInfo;
            binding.Converter = new Converters.BoolVisibilityConverter();
            this.waitingPanel.SetBinding(UserControl.VisibilityProperty, binding);
        }
    }
}
